package com.youhui.weixin.controller;

import com.youhui.weixin.dao.AdminDao;
import com.youhui.weixin.domain.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * Created by https://github.com/kuangcp on 17-10-9  下午6:21
 * 不能命名为 MainCtroller
 */
@RestController
public class WorkController {

    @Autowired
    AdminDao adminDao;


    @RequestMapping("/find/{page}/{size}")
    public Page<Admin> getAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size){
//        Sort sort = new Sort(Sort.Direction.DESC, "adminId");
        Pageable pageable = new PageRequest(page, size);
        return adminDao.findAll(pageable);
    }

}
